{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}
{% import "_my_wtf_macros.html" as my_wtf_macros %}
{% import "user/partial/search_user_form.html" as search_user_form_macro %}
{% import "user/partial/user_table.html" as user_table_macro %}

{% block title %}万屏时代OPC--取关用户列表{% endblock %}

{% block panel_heading %}
  万屏时代OPC--取关用户列表
{% endblock %}

{% block panel_body %}
    <form id="search-user-form" action="{{ url_for('op_bp.cancel_attention_user_list') }}" method="post" class="form" role="form">
        {{ my_wtf_macros.form_field(form.uid, div_col=4, label_col=4, field_col=7) }}
        {{ my_wtf_macros.form_field(form.mobile, div_col=4, label_col=4, field_col=7) }}
        {{ my_wtf_macros.form_field(form.nickname, div_col=4, label_col=4, field_col=7) }}
        <div class="clearfix visible-xs-block visible-sm-block visible-md-block visible-lg-block"></div>
        {{ my_wtf_macros.form_field(form.current_attention, div_col=4, label_col=4, field_col=7)}}
        {{ my_wtf_macros.form_field(form.cancel_attent_time_begin, div_col=4, label_col=4, field_col=7) }}
        {{ my_wtf_macros.form_field(form.cancel_attent_time_end, div_col=4, label_col=4, field_col=7) }}
        <div class="clearfix visible-xs-block visible-sm-block visible-md-block visible-lg-block"></div>
        {{ my_wtf_macros.form_field(form.has_recharge, div_col=4, label_col=4, field_col=7)}}
        {{ my_wtf_macros.form_field(form.has_partic, div_col=4, label_col=4, field_col=7)}}
        {{ my_wtf_macros.form_field(form.has_pack, div_col=4, label_col=4, field_col=7)}}
        <div class="clearfix visible-xs-block visible-sm-block visible-md-block visible-lg-block"></div>
        <div class="pull-right btn-group">
            <button type="submit" class="btn btn-info"
                    id="query-demand-btn">
                查询
            </button>
        </div>
    </form>

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'op_bp.cancel_attention_user_list', **url_kwargs) }}
    </div>
    {% endif %}

    <table id="cancel-attention-user-info-table" class="table table-bordered table-hover table-condensed table-striped">
        <thead>
            <tr>
                <th>用户ID</th>
                <th>电话</th>
                <th>昵称</th>
                <th>微信openid</th>
                <th>当前是否关注</th>
                <th>加盟时间</th>
                <th>取关时间</th>
                <th>充过值</th>
                <th>抢过单</th>
                <th>有套餐</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for i in users %}
            <tr>
                <td>{{ i.uid }}</td>
                <td>{{ i.mobile | encrypt }}</td>
                <td>{{ i.nickname }}</td>
                <td>
                  {% if i.wx_openid %}
                    {{ i.wx_openid }}
                  {% else %}
                    {{ i.owner.wx_openid }}
                  {% endif %}
                </td>
                <td>{{ i.current_attention_display }}</td>
                <td>{{ i.owner.created_datetime }}</td>
                <td>{{ i.cancel_attent_time }}</td>
                <td>{{ i.has_recharge_display }}</td>
                <td>{{ i.has_partic_display }}</td>
                <td>{{ i.has_pack_display }}</td>
                <td>
                    <a
                      class="btn btn-xs btn-primary"
                      href="{{url_for('op_bp.user_info', user_id=i.uid)}}"
                      name="user-info"
                      target="_blank"
                    >编辑</a><br>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'op_bp.cancel_attention_user_list', **url_kwargs) }}
    </div>
    {% endif %}

{% endblock %}

